package com.txts.road.admin.fenceSys.service.impl;

import com.txts.road.admin.common.utils.DateUtils;
import com.txts.road.admin.fenceSys.domain.FenceInfo;
import com.txts.road.admin.fenceSys.mapper.FenceInfoMapper;
import com.txts.road.admin.fenceSys.service.IFenceInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 电子围栏信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-13
 */
@Service
public class FenceInfoServiceImpl implements IFenceInfoService
{
    @Resource
    private FenceInfoMapper fenceInfoMapper;

    /**
     * 查询电子围栏信息
     *
     * @param fenceId 电子围栏信息主键
     * @return 电子围栏信息
     */
    @Override
    public FenceInfo selectFenceInfoByFenceId(Long fenceId)
    {
        return fenceInfoMapper.selectFenceInfoByFenceId(fenceId);
    }

    /**
     * 查询电子围栏信息列表
     *
     * @param fenceInfo 电子围栏信息
     * @return 电子围栏信息
     */
    @Override
    public List<FenceInfo> selectFenceInfoList(FenceInfo fenceInfo)
    {
        return fenceInfoMapper.selectFenceInfoList(fenceInfo);
    }

    /**
     * 新增电子围栏信息
     *
     * @param fenceInfo 电子围栏信息
     * @return 结果
     */
    @Override
    public int insertFenceInfo(FenceInfo fenceInfo)
    {
        fenceInfo.setCreateTime(DateUtils.getNowDate());
        return fenceInfoMapper.insertFenceInfo(fenceInfo);
    }

    /**
     * 修改电子围栏信息
     *
     * @param fenceInfo 电子围栏信息
     * @return 结果
     */
    @Override
    public int updateFenceInfo(FenceInfo fenceInfo)
    {
        fenceInfo.setUpdateTime(DateUtils.getNowDate());
        return fenceInfoMapper.updateFenceInfo(fenceInfo);
    }

    /**
     * 批量删除电子围栏信息
     *
     * @param fenceIds 需要删除的电子围栏信息主键
     * @return 结果
     */
    @Override
    public int deleteFenceInfoByFenceIds(Long[] fenceIds)
    {
        return fenceInfoMapper.deleteFenceInfoByFenceIds(fenceIds);
    }

    /**
     * 删除电子围栏信息信息
     *
     * @param fenceId 电子围栏信息主键
     * @return 结果
     */
    @Override
    public int deleteFenceInfoByFenceId(Long fenceId)
    {
        return fenceInfoMapper.deleteFenceInfoByFenceId(fenceId);
    }
}
